﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _0323CSharp
{
    class Program
    {
        static void Main(string[] args)
        {
            Test t1 = new Test();
            Test t3 = new Test();
            t3 = t1;
            Test t2 = t1;
            t1.x = 111;

            Console.WriteLine("t1.x = {0}; t1.y = {1};", t1.x, t1.y);
            Console.WriteLine("t2.x = {0}; t2.y = {1};", t2.x, t2.y);
            Console.WriteLine("t3.x = {0}; t3.y = {1};", t3.x, t3.y);


            string str = "胡子敬";
            string str1 = "ok";
            string str12 = "OK";//大写的ok
            string strNull = null;
            string str0 = "";

            
            // string str = null;(空值)  string str = "";(空串)
            if (str0.Equals(string.Empty)) { Console.WriteLine("为真"); };//  判断字符串 str0 是否为 空串
            if (string.IsNullOrEmpty(strNull)) { Console.WriteLine("该字符串 是空串 或 空值 "); };

            // 字符串 两者之间比较
            // 1
            if (string.Equals(str, str1)) // 或  if(str == str1)
            { 
                Console.WriteLine("两者一样");
            }
            else
            {
                Console.WriteLine("两者不一样");
            }
            // 2
            Console.WriteLine(" str str1 compare = {0}",str.CompareTo(str1));
            Console.WriteLine(" str12 str1 compare = {0}", str12.CompareTo(str1));
            Console.WriteLine(" str1 str12 compare = {0}", str1.CompareTo(str12));
            Console.WriteLine(" str1 str12 compare true = {0}", string.Compare(str1,str12,true));//不区分大小写
            string str2 = "";
            string ss = str2.PadLeft(100, 'x');  // 总字符串长度 100 ， 在 str2 的左侧加 ‘x’ ，直到补满长度， 还有 PadRight

            string str3 = "abc\tefg\rjkl"; // \r 换行符 ，重回本行 覆盖 abc\tefg;   \b 退格符 ，重回前一格，也会覆盖
           
            Console.ReadKey();
        }
    }
    class Test
    {
       public int x = 10;
       public int y = 20;
    }
}
